#!/usr/bin/python2.4


import optparse


parser = optparse.OptionParser()
options = None
arguments = None


def set_usage(*args, **dargs):
  return parser.set_usage(*args, **dargs)


def set_version(version):
  parser.version = version
  add_option('--version', action='version')


def add_option(*args, **dargs):
  return parser.add_option(*args, **dargs)


def remove_option(*args, **dargs):
  return parser.remove_option(*args, **dargs)


def get_option(name, default=None):
  return getattr(options, name, default)


def parse_options(*args, **dargs):
  global options, arguments
  options, arguments = parser.parse_args(*args, **dargs)
  return parser, options, arguments
